home *** CD-ROM | disk | FTP | other *** search
/ Gigantic Games 2 / Gigantic Games 2.iso / pc / _m_ / matrixblaster / matrixblastersrc.amos / matrixblastersrc.amosSourceCode < prev    next >
AMOS Source Code  |  1994-12-22  |  20KB  |  717 lines

  1. Rem - v1 of matrix blaster - 25 Dec 93     
  2.  
  3.  
  4. '   --MAIN-- 
  5.  
  6. Rem repeat until end of game 
  7. Dim SCORE(6),LEVEL(6),PLIFE(6),LAMER(6) : Rem amos would not allow array to be 
  8. '  dimensioned in subroutine, when called in MAIN loop 
  9.  
  10.  
  11. '  rem load banks  
  12. Load "sounds",5
  13. Load "sounds2",11
  14. Load "pic1",9
  15. Load "pic2",10
  16. Load "pic3",15
  17.  
  18. Gosub PICSEQ
  19. Gosub TITLESEQ
  20. Gosub VARDEF
  21. Gosub VARINIT
  22. Gosub OLDHISCORE
  23. Gosub INITSCREEN
  24. Rem repeat until player dies 
  25. DLAY=0
  26.  
  27. Rem fire button accelerates bike 
  28.  
  29. Do 
  30.    Do 
  31.       If LAMER(CURRENTPLAYER)=True
  32.          Wait 1
  33.       End If 
  34.       Rem On Break Proc CLEANUP
  35.       If Fire(1)
  36.          THICK=2
  37.       Else 
  38.          THICK=1
  39.       End If 
  40.       If Not(BIKEALIVE)
  41.          Exit 
  42.       End If 
  43.       MOVEBIKE
  44.       BIKECHECK
  45.       If E1LIVE=0
  46.          ENEMX=ENEM1X : ENEMY=ENEM1Y : ENEMDIR=ENEM1DIR : ENEMLIVE=E1LIVE
  47.          MOVEENEM
  48.          ENEM1X=ENEMX : ENEM1Y=ENEMY : ENEM1DIR=ENEMDIR : E1LIVE=ENEMLIVE
  49.          If Not(BIKEALIVE)
  50.             Exit 
  51.          End If 
  52.          MOVEBIKE
  53.          BIKECHECK
  54.       End If 
  55.       If E2LIVE=0 and LEVEL(CURRENTPLAYER)>1
  56.          ENEMX=ENEM2X : ENEMY=ENEM2Y : ENEMDIR=ENEM2DIR : ENEMLIVE=E2LIVE
  57.          MOVEENEM
  58.          ENEM2X=ENEMX : ENEM2Y=ENEMY : ENEM2DIR=ENEMDIR : E2LIVE=ENEMLIVE
  59.          If Not(BIKEALIVE)
  60.             Exit 
  61.          End If 
  62.          MOVEBIKE
  63.          BIKECHECK
  64.       End If 
  65.       If E3LIVE=0 and LEVEL(CURRENTPLAYER)>2
  66.          ENEMX=ENEM3X : ENEMY=ENEM3Y : ENEMDIR=ENEM3DIR : ENEMLIVE=E3LIVE
  67.          MOVEENEM
  68.          ENEM3X=ENEMX : ENEM3Y=ENEMY : ENEM3DIR=ENEMDIR : E3LIVE=ENEMLIVE
  69.          If Not(BIKEALIVE)
  70.             Exit 
  71.          End If 
  72.       End If 
  73.       If LEVEL(CURRENTPLAYER)=1 and E1LIVE=1
  74.          LEVEL(CURRENTPLAYER)=2
  75.          Gosub BONUS
  76.          Exit : Rem from combat loop 
  77.       End If 
  78.       If LEVEL(CURRENTPLAYER)=2 and E1LIVE=1 and E2LIVE=1
  79.          LEVEL(CURRENTPLAYER)=3
  80.          Gosub BONUS
  81.          Exit : Rem from combat loop 
  82.       End If 
  83.       If LEVEL(CURRENTPLAYER)>2 and E1LIVE=1 and E2LIVE=1 and E3LIVE=1
  84.          LEVEL(CURRENTPLAYER)=LEVEL(CURRENTPLAYER)+1
  85.          Gosub BONUS
  86.          Exit : Rem from combat loop 
  87.       End If 
  88.       If BIKEALIVE=False
  89.          Exit : Rem exit from combat loop
  90.       End If 
  91.       If DLAY>=18
  92.          DLAY=0
  93.       End If 
  94.    Loop 
  95.  
  96.    If BIKEALIVE=False and PLIFE(CURRENTPLAYER)=0 : Rem one guy loses all lives  
  97.       If CURRENTPLAYER=2
  98.          If PLIFE(6)=0 : Rem other player's lives gone too
  99.             
  100.             Rem - this works for one player mode as well 
  101.             ' because in 1 player mode, plaler 2 lives are set to 0
  102.             
  103.             Gosub AGAINPLAY : Rem ask for another game 
  104.             Gosub TITLESEQ
  105.             Gosub VARDEF
  106.          Else If PLIFE(6)>0 : Rem other player still alive 
  107.             CURRENTPLAYER=6 : Rem switch to other player 
  108.          End If 
  109.       Else : Rem player is #6, not #2 
  110.          If PLIFE(2)=0 : Rem other player's lives gone too
  111.             Gosub AGAINPLAY : Rem ask for another game 
  112.          Else If PLIFE(2)>0 : Rem other player still alive 
  113.             CURRENTPLAYER=2 : Rem switch to other player 
  114.          End If 
  115.       End If 
  116.    Else If BIKEALIVE=False and PLIFE(CURRENTPLAYER)>0 : Rem still has some lives 
  117.       If TWOMODE=True : Rem if two playing, switch to other
  118.          If CURRENTPLAYER=2
  119.             CURRENTPLAYER=6
  120.          Else If CURRENTPLAYER=6
  121.             CURRENTPLAYER=2
  122.          End If 
  123.       Else If TWOMODE=False : Rem only one player mode 
  124.          Rem no op  
  125.       End If 
  126.    End If 
  127.    
  128.    ' am assuming exit from combat=death of player or next level of play 
  129.  
  130.    Gosub VARINIT
  131.    Gosub INITSCREEN
  132. Loop 
  133. '  --END-- 
  134. End 
  135.  
  136. Procedure MOVEBIKE
  137.    If Jright(1) and BIKECHANGE=False
  138.       Add BIKEX,THICK
  139.       If BIKEDIR<>MRIGHT
  140.          BIKECHANGE=True
  141.       End If 
  142.       
  143.       Rem this is here for people who keep 
  144.       '   pressing the joystick in one direction.  if this was not 
  145.       '   here, the program would read *ANY* input as a change of
  146.       '   direction, and would slow the line down
  147.       
  148.       BIKEDIR=MRIGHT
  149.    Else If Jleft(1) and BIKECHANGE=False
  150.       Add BIKEX,-THICK
  151.       If BIKEDIR<>MLEFT
  152.          BIKECHANGE=True
  153.       End If 
  154.       BIKEDIR=MLEFT
  155.    Else If Jup(1) and BIKECHANGE=False
  156.       Add BIKEY,-THICK
  157.       If BIKEDIR<>MUP
  158.          BIKECHANGE=True
  159.       End If 
  160.       BIKEDIR=MUP
  161.    Else If Jdown(1) and BIKECHANGE=False
  162.       Add BIKEY,THICK
  163.       If BIKEDIR<>MDOWN
  164.          BIKECHANGE=True
  165.       End If 
  166.       BIKEDIR=MDOWN
  167.    Else If(Joy(1)<>1 and Joy(1)<>2 and Joy(1)<>4 and Joy(1)<>8)
  168.       If BIKEDIR=MDOWN
  169.          Add BIKEY,THICK
  170.       Else If BIKEDIR=MUP
  171.          Add BIKEY,-THICK
  172.       Else If BIKEDIR=MRIGHT
  173.          Add BIKEX,THICK
  174.       Else If BIKEDIR=MLEFT
  175.          Add BIKEX,-THICK
  176.       End If 
  177.    End If 
  178.    
  179.    If BIKECHANGE=True : Rem change of direction occurred 
  180.       BIKEWAIT=BIKEWAIT+1
  181.       SCUPDATE=True
  182.       Rem following block: keep moving bike in same direction  
  183.       
  184.       If BIKEDIR=MDOWN
  185.          Add BIKEY,THICK
  186.       Else If BIKEDIR=MUP
  187.          Add BIKEY,-THICK
  188.       Else If BIKEDIR=MRIGHT
  189.          Add BIKEX,THICK
  190.       Else If BIKEDIR=MLEFT
  191.          Add BIKEX,-THICK
  192.       End If 
  193.    End If 
  194.    
  195.    If BIKEWAIT>5 : Rem bike must move in same direction for 5 "steps" 
  196.       BIKECHANGE=False : Rem before being allowed to change direction 
  197.       BIKEWAIT=1 : Rem reset variables  
  198.    End If 
  199.    
  200. End Proc
  201.  
  202. Procedure BIKECHECK
  203.    If BIKEDIR=MUP
  204.    CP=Point(BIKEX,BIKEY-4)
  205.    If CP<>BKCOLOR
  206.          DESTRUCT[BIKEX-4,BIKEY-4] : YOUDIE
  207.       End If 
  208.    Else If BIKEDIR=MRIGHT
  209.       CP=Point(BIKEX+4,BIKEY)
  210.       If CP<>BKCOLOR
  211.          DESTRUCT[BIKEX-4,BIKEY-4] : YOUDIE
  212.       End If 
  213.    Else If BIKEDIR=MDOWN
  214.       CP=Point(BIKEX,BIKEY+4)
  215.       If CP<>BKCOLOR
  216.          DESTRUCT[BIKEX-4,BIKEY-4] : YOUDIE
  217.       End If 
  218.    Else If BIKEDIR=MLEFT
  219.       CP=Point(BIKEX-4,BIKEY)
  220.       If CP<>BKCOLOR
  221.          DESTRUCT[BIKEX-4,BIKEY-4] : YOUDIE
  222.       End If 
  223.    End If 
  224.    Ink BIKETRAIL
  225.    Bar BIKEX-2,BIKEY-2 To BIKEX+2,BIKEY+2
  226.  
  227.    If SCUPDATE=True
  228.       If CURRENTPLAYER=2
  229.          Locate 62,10 : Print "SCORE: ";SCORE(CURRENTPLAYER)
  230.       Else 
  231.          Locate 62,16 : Print "SCORE: ";SCORE(CURRENTPLAYER)
  232.       End If 
  233.    Locate 62,24 : Print "HIGH:  ";HISCORE
  234.    SCUPDATE=False
  235.    End If 
  236. End Proc
  237.  
  238. Procedure MOVEENEM
  239.    Shared ENEMX,ENEMY,ENEMDIR,ENEMLIVE
  240.    LEFTEDGE=0 : RIGHTEDGE=0 : LEFTTOP=0 : RIGHTTOP=0
  241.    PATHFOR=True : PATHLEF=True : PATHRIGHT=True
  242.    If ENEMDIR=MDOWN
  243.       For COUNT=4 To 8 Step 2
  244.          Rem check ahead
  245.          LEFTEDGE=ENEMX+2 : RIGHTEDGE=ENEMX-2
  246.          CP=Point(LEFTEDGE,ENEMY+COUNT)
  247.          If CP<>BKCOLOR
  248.             PATHFOR=False
  249.          End If 
  250.          CP=Point(RIGHTEDGE,ENEMY+COUNT)
  251.          If CP<>BKCOLOR
  252.             PATHFOR=False
  253.          End If 
  254.          Rem check right  
  255.          CP=Point(RIGHTEDGE-COUNT,ENEMY)
  256.          If CP<>BKCOLOR
  257.             PATHRIGHT=False
  258.          End If 
  259.          RIGHTTOP=ENEMY-4
  260.          CP=Point(RIGHTEDGE-COUNT,RIGHTTOP)
  261.          If CP<>BKCOLOR
  262.             PATHRIGHT=False
  263.          End If 
  264.          Rem check left 
  265.          LEFTTOP=ENEMY-4
  266.          CP=Point(LEFTEDGE+COUNT,ENEMY)
  267.          If CP<>BKCOLOR
  268.             PATHLEF=False
  269.          End If 
  270.          CP=Point(LEFTEDGE+COUNT,LEFTTOP)
  271.          If CP<>BKCOLOR
  272.             PATHLEF=False
  273.          End If 
  274.          Rem where can enemy go?  
  275.          If PATHFOR=False and PATHLEF=False and PATHRIGHT=False
  276.             Proc DIE[ENEMX,ENEMY] : ENEMLIVE=1 : Pop Proc
  277.          Else If PATHFOR=True and PATHLEF=True and PATHRIGHT=True
  278.             ENEMDIR=MDOWN : Rem go down
  279.          Else If PATHLEF=False and PATHRIGHT=False
  280.             ENEMDIR=MDOWN : Rem go Down
  281.          Else If PATHLEF=False and PATHFOR=False
  282.             ENEMDIR=MLEFT : Rem turn left  
  283.          Else If PATHFOR=False and PATHRIGHT=False
  284.             ENEMDIR=MRIGHT : Rem turn right   
  285.          Else If PATHFOR=False
  286.             If BIKEX<ENEMX
  287.                ENEMDIR=MLEFT : Rem turn left  
  288.             Else 
  289.               ENEMDIR=MRIGHT : Rem turn right   
  290.             End If 
  291.          End If 
  292.       Next COUNT
  293.       Ink ENEMYTRAIL : Bar ENEMX-2,ENEMY-2 To ENEMX+2,ENEMY+2
  294.       If ENEMDIR=MLEFT
  295.          ENEMX=ENEMX-2
  296.       End If 
  297.       If ENEMDIR=MRIGHT
  298.          ENEMX=ENEMX+2
  299.       End If 
  300.       If ENEMDIR=MDOWN
  301.          ENEMY=ENEMY+2
  302.       End If 
  303.    CHECKED=True
  304.    Else If ENEMDIR=MUP : Rem up 
  305.       For COUNT=4 To 8 Step 2
  306.          Rem check ahead
  307.          LEFTEDGE=ENEMX-2 : RIGHTEDGE=ENEMX+2 : LEFTTOP=ENEMY+4 : RIGHTTOP=ENEMY+4
  308.          CP=Point(LEFTEDGE,ENEMY-COUNT)
  309.          If CP<>BKCOLOR
  310.             PATHFOR=False
  311.          End If 
  312.          CP=Point(RIGHTEDGE,ENEMY-COUNT)
  313.          If CP<>BKCOLOR
  314.             PATHFOR=False
  315.          End If 
  316.          Rem check right
  317.          CP=Point(RIGHTEDGE+COUNT,ENEMY)
  318.          If CP<>BKCOLOR
  319.             PATHRIGHT=False
  320.          End If 
  321.          CP=Point(RIGHTEDGE+COUNT,RIGHTTOP)
  322.          If CP<>BKCOLOR
  323.             PATHRIGHT=False
  324.          End If 
  325.          Rem check left 
  326.          CP=Point(LEFTEDGE-COUNT,ENEMY)
  327.          If CP<>BKCOLOR
  328.             PATHLEF=False
  329.          End If 
  330.          CP=Point(LEFTEDGE-COUNT,LEFTTOP)
  331.          If CP<>BKCOLOR
  332.             PATHLEF=False
  333.          End If 
  334.         Rem where can enemy go?  
  335.          If PATHFOR=False and PATHLEF=False and PATHRIGHT=False
  336.               Proc DIE[ENEMX,ENEMY] : ENEMLIVE=1 : Pop Proc
  337.          Else If PATHFOR=True and PATHLEF=True and PATHRIGHT=True
  338.             ENEMDIR=MUP : Rem go up
  339.          Else If PATHLEF=False and PATHRIGHT=False
  340.             ENEMDIR=MUP : Rem go up
  341.          Else If PATHLEF=False and PATHFOR=False
  342.             ENEMDIR=MRIGHT : Rem turn right 
  343.          Else If PATHFOR=False and PATHRIGHT=False
  344.             ENEMDIR=MLEFT : Rem turn left
  345.          Else If PATHFOR=False
  346.             If BIKEX<ENEMX
  347.                ENEMDIR=MLEFT : Rem turn left
  348.             Else 
  349.                ENEMDIR=MRIGHT : Rem turn right   
  350.             End If 
  351.          End If 
  352.       Next COUNT
  353.       Ink ENEMYTRAIL : Bar ENEMX-2,ENEMY-2 To ENEMX+2,ENEMY+2
  354.       If ENEMDIR=MLEFT
  355.          ENEMX=ENEMX-2
  356.       End If 
  357.       If ENEMDIR=MRIGHT
  358.          ENEMX=ENEMX+2
  359.       End If 
  360.       If ENEMDIR=MUP
  361.          ENEMY=ENEMY-2
  362.       End If 
  363.    Else If ENEMDIR=MLEFT : Rem left 
  364.       For COUNT=4 To 8 Step 2
  365.          Rem check ahead
  366.          LEFTEDGE=ENEMY+2 : RIGHTEDGE=ENEMY-2 : LEFTTOP=ENEMX+4 : RIGHTTOP=ENEMX+4
  367.          CP=Point(ENEMX-COUNT,LEFTEDGE)
  368.          If CP<>BKCOLOR
  369.             PATHFOR=False
  370.          End If 
  371.          CP=Point(ENEMX-COUNT,RIGHTEDGE)
  372.          If CP<>BKCOLOR
  373.             PATHFOR=False
  374.          End If 
  375.          Rem check right  
  376.          CP=Point(ENEMX,RIGHTEDGE-COUNT)
  377.          If CP<>BKCOLOR
  378.             PATHRIGHT=False
  379.          End If 
  380.          CP=Point(RIGHTTOP,RIGHTEDGE-COUNT)
  381.          If CP<>BKCOLOR
  382.             PATHRIGHT=False
  383.          End If 
  384.          Rem check left 
  385.          CP=Point(ENEMX,LEFTEDGE+COUNT)
  386.          If CP<>BKCOLOR
  387.             PATHLEF=False
  388.          End If 
  389.          CP=Point(LEFTTOP,LEFTEDGE+COUNT)
  390.          If CP<>BKCOLOR
  391.             PATHLEF=False
  392.          End If 
  393.          Rem where can enemy go?  
  394.          If PATHFOR=False and PATHLEF=False and PATHRIGHT=False
  395.             Proc DIE[ENEMX,ENEMY] : ENEMLIVE=1 : Pop Proc
  396.          Else If PATHFOR=True and PATHLEF=True and PATHRIGHT=True
  397.             ENEMDIR=MLEFT : Rem go left  
  398.          Else If PATHLEF=False and PATHRIGHT=False
  399.             ENEMDIR=MLEFT : Rem go left  
  400.          Else If PATHLEF=False and PATHFOR=False
  401.             ENEMDIR=MUP : Rem turn up  
  402.          Else If PATHFOR=False and PATHRIGHT=False
  403.             ENEMDIR=MDOWN : Rem turn down
  404.          Else If PATHFOR=False
  405.             If BIKEY<ENEMY
  406.                ENEMDIR=MUP : Rem if bike is above, turn up
  407.             Else 
  408.                ENEMDIR=MDOWN : Rem if bike is below, turn down
  409.              End If 
  410.          End If 
  411.       Next COUNT
  412.       Ink ENEMYTRAIL : Bar ENEMX-2,ENEMY-2 To ENEMX+2,ENEMY+2
  413.       If ENEMDIR=MUP
  414.          ENEMY=ENEMY-2
  415.       End If 
  416.       If ENEMDIR=MDOWN
  417.          ENEMY=ENEMY+2
  418.       End If 
  419.       If ENEMDIR=MLEFT
  420.          ENEMX=ENEMX-2
  421.       End If 
  422.    Else If ENEMDIR=MRIGHT : Rem right
  423.       For COUNT=4 To 8 Step 2
  424.          LEFTEDGE=ENEMY-2 : RIGHTEDGE=ENEMY+2 : RIGHTTOP=ENEMX-4 : LEFTTOP=ENEMX-4
  425.          Rem check ahead
  426.          CP=Point(ENEMX+COUNT,LEFTEDGE)
  427.          If CP<>BKCOLOR
  428.             PATHFOR=False
  429.          End If 
  430.          CP=Point(ENEMX+COUNT,RIGHTEDGE)
  431.          If CP<>BKCOLOR
  432.             PATHFOR=False
  433.          End If 
  434.          CP=Point(ENEMX,RIGHTEDGE+COUNT)
  435.          Rem check right  
  436.          If CP<>BKCOLOR
  437.              PATHRIGHT=False
  438.          End If 
  439.          CP=Point(RIGHTTOP,RIGHTEDGE+COUNT)
  440.          If CP<>BKCOLOR
  441.              PATHRIGHT=False
  442.          End If 
  443.          CP=Point(ENEMX,LEFTEDGE-COUNT)
  444.          Rem check left 
  445.          If CP<>BKCOLOR
  446.             PATHLEF=False
  447.          End If 
  448.          CP=Point(LEFTTOP,LEFTEDGE-COUNT)
  449.          If CP<>BKCOLOR
  450.             PATHLEF=False
  451.          End If 
  452.          Rem where can bike go? 
  453.          If PATHFOR=False and PATHLEF=False and PATHRIGHT=False
  454.             Proc DIE[ENEMX,ENEMY] : ENEMLIVE=1 : Pop Proc
  455.          Else If PATHFOR=True and PATHLEF=True and PATHRIGHT=True : Rem clear
  456.             ENEMDIR=MRIGHT : Rem go right 
  457.          Else If PATHLEF=False and PATHRIGHT=False
  458.             ENEMDIR=MRIGHT : Rem go right 
  459.          Else If PATHLEF=False and PATHFOR=False
  460.             ENEMDIR=MDOWN : Rem turn down  
  461.          Else If PATHFOR=False and PATHRIGHT=False
  462.             ENEMDIR=MUP : Rem turn up
  463.          Else If PATHFOR=False
  464.             If BIKEY<ENEMY
  465.                ENEMDIR=MUP : Rem if bike is above, turn up
  466.             Else 
  467.                ENEMDIR=MDOWN : Rem turn down if bike is below 
  468.              End If 
  469.          End If 
  470.       Next COUNT
  471.       Ink ENEMYTRAIL : Bar ENEMX-2,ENEMY-2 To ENEMX+2,ENEMY+2
  472.       If ENEMDIR=MUP
  473.          ENEMY=ENEMY-2
  474.       End If 
  475.       If ENEMDIR=MDOWN
  476.          ENEMY=ENEMY+2
  477.       End If 
  478.       If ENEMDIR=MRIGHT
  479.          ENEMX=ENEMX+2
  480.       End If 
  481.    End If 
  482. End Proc
  483.  
  484. Procedure DESTRUCT[X,Y]
  485.    Sam Bank 5
  486.    Sam Play 2
  487.    Bob 0,X,Y,3
  488.    Wait 5
  489.    Bob 0,X,Y,4
  490.    Wait 5
  491.    Bob 0,X,Y,5
  492.    Wait 5
  493.    Bob 0,X,Y,6
  494.    Wait 5
  495.    Bob 0,X,Y,7
  496.    Wait 5
  497.    Bob 0,X,Y,8
  498.    Wait 5
  499.    Bob 0,X,Y,9
  500.    Wait 5
  501.    Bob 0,X,Y,10
  502.    Wait 5
  503.    Bob 0,X,Y,11
  504.    Wait 5
  505.    Bob 0,X,Y,12
  506.    Wait 5
  507. Bob Off 0
  508.  
  509. End Proc
  510.  
  511. Procedure DIE[ENEMX,ENEMY]
  512.    Ink 5
  513.    Paint ENEMX,ENEMY,1
  514.    DESTRUCT[ENEMX-4,ENEMY-4]
  515.    SCORE(CURRENTPLAYER)=SCORE(CURRENTPLAYER)+500
  516.    If SCORE(CURRENTPLAYER)>HISCORE
  517.    HISCORE=SCORE(CURRENTPLAYER)
  518.    End If 
  519. End Proc
  520.  
  521. Procedure YOUDIE
  522.    Open Out 1,"ram:hiscore"
  523.    Print #1,HISCORE
  524.    Close 1
  525.    BIKEALIVE=False
  526.    PLIFE(CURRENTPLAYER)=PLIFE(CURRENTPLAYER)-1 : Rem remove one life, and associated bob
  527.    Bob Off PLIFE(CURRENTPLAYER)
  528. End Proc
  529.  
  530.  
  531. VARDEF:
  532.    Rem define our variables 
  533.    Rem BIKEX,BIKEY = bike co-ordinates  
  534.    Rem THICK = how frequently to plot light trail 
  535.    Rem bikedir = direction of bike
  536.    Global BIKEX,BIKEY,BIKEDIR,THICK
  537.  
  538.    Rem biketrail, enemytrail = colors of light cycles 
  539.    Global BIKETRAIL,ENEMYTRAIL
  540.  
  541.    Rem PATHFOR,PATHLEF,PATHRIGHT indicate if enemy can take a path forward, 
  542.    Rem left, or right relative to its direction (boolean) 
  543.    Global PATHFOR,PATHLEF,PATHRIGHT
  544.    Rem Elive1->3  = # of bikes
  545.    Global ELIVE1,ELIVE2,ELIVE3
  546.  
  547.    Rem MDOWN,MLEFT,MRIGHT,MUP direction enemy is moving on screen 
  548.    Global MDOWN,MLEFT,MRIGHT,MUP
  549.  
  550.    Rem BKCOLOR = arena background color 
  551.    Global BKCOLOR
  552.  
  553.    Rem scupdate = (boolean) update high score 
  554.    Global HISCORE,SCUPDATE
  555.  
  556.    Rem BIKEWAIT, wait 5 steps before changing directions  
  557.    Rem BIKECHANGE, test for change of direction 
  558.    Global BIKEWAIT,BIKECHANGE,BIKEALIVE
  559.  
  560.    Global CURRENTPLAYER,TWOMODE,SCORE(),LEVEL(),PLIFE()
  561.    Global LAMER()
  562.  
  563.    SCUPDATE=False : LEVEL(2)=1 : PLIFE(2)=3 : LEVEL(6)=1
  564.    If TWOMODE=True : Rem if two players, give player two 3 lives, or ignore 
  565.       PLIFE(6)=3
  566.    Else PLIFE(6)=0
  567.       End If 
  568.    CURRENTPLAYER=2
  569. Return 
  570.  
  571. VARINIT:
  572.    DEBUG=True
  573.    MUP=1 : MLEFT=2 : MDOWN=3 : MRIGHT=4
  574.    BIKEX=200 : BIKEY=340 : BIKEALIVE=True : THICK=1
  575.    BKCOLOR=5
  576.    BIKEDIR=MUP : BIKECHANGE=False
  577.    Rem enem(num)x,enem(num)y,enem(num)dir =x,y & directions of enemy bikes
  578.    ENEM1X=200 : ENEM1Y=50 : ENEM1DIR=MDOWN : E1LIVE=0
  579.    ENEM2X=300 : ENEM2Y=50 : ENEM2DIR=MDOWN : E2LIVE=0
  580.    ENEM3X=100 : ENEM3Y=50 : ENEM3DIR=MDOWN : E3LIVE=0
  581.    BIKETRAIL=CURRENTPLAYER : ENEMYTRAIL=4
  582. Return 
  583.  
  584. OLDHISCORE:
  585.    FCHEK=Exist("Ram:hiscore")
  586.    If FCHEK=-1
  587.       Open In 1,"ram:hiscore"
  588.       Input #1,HISCORE
  589.       Close 1
  590.    Else 
  591.       Open Out 1,"Ram:hiscore"
  592.       Print #1,HISCORE
  593.       Close 1
  594.    End If 
  595. Return 
  596.  
  597. PICSEQ:
  598.    Screen Open 0,640,400,16,Hires+Laced
  599.    Hide 
  600.    Unpack 15 To 0
  601.    Sam Bank 5
  602.    Sam Loop On 
  603.    Sam Play 3
  604.    Wait Key 
  605.    Sam Loop Off 
  606.    Erase 0
  607. Return 
  608.  
  609. TITLESEQ:
  610.    Unpack 9 To 0
  611.    Wait 10
  612.    Sam Play 1
  613.    Wait 160
  614.    Wait Key 
  615.    Do : Rem wait for 1/2 player input
  616.       If Key State(80)=True : Rem pressed F1   
  617.          TWOMODE=False : LAMER(2)=True
  618.          Exit 
  619.       Else If Key State(81)=True : Rem pressed F2 
  620.          TWOMODE=False : LAMER(2)=False
  621.          Exit 
  622.       Else If Key State(82)=True : Rem pressed F3 
  623.          TWOMODE=True : LAMER(2)=True : LAMER(6)=True
  624.          Exit 
  625.       Else If Key State(83)=True : Rem pressed F4 
  626.          TWOMODE=True : LAMER(2)=False : LAMER(6)=False
  627.          Exit 
  628.       Else If Key State(84)=True : Rem pressed F5 
  629.          TWOMODE=True : LAMER(2)=True : LAMER(6)=False
  630.          Exit 
  631.       Else If Key State(85)=True : Rem pressed F6 
  632.          TWOMODE=True : LAMER(2)=False : LAMER(6)=True
  633.          Exit 
  634.       End If 
  635.    Loop 
  636.    Erase 0
  637. Return 
  638.  
  639. INITSCREEN:
  640.    Unpack 10 To 0
  641.    Wait 57
  642.    Flash 3,"(000,10)(330,10)(660,10)(990,10)(cc0,10)(ff0,10)(cc0,10)(990,10)(660,10)(330,10)(000,10)"
  643.    Paper 12
  644.    Locate 62,11 : Print "LEVEL: ";LEVEL(2)
  645.    Locate 62,10 : Print "SCORE: ";SCORE(2)
  646.    Locate 62,17 : Print "LEVEL: ";LEVEL(6)
  647.    Locate 62,16 : Print "SCORE: ";SCORE(6)
  648.    Locate 62,24 : Print "HIGH:  ";HISCORE
  649.    If CURRENTPLAYER=2 : Rem select colour of bases 
  650.       IMAGE=2
  651.    Else 
  652.       IMAGE=1
  653.    End If 
  654.    For T=1 To PLIFE(CURRENTPLAYER) : Rem placing bases (# of lives) 
  655.       Bob T,454+(T*16),35,IMAGE
  656.    Next T : Rem end of placing bases 
  657.    Open In 1,"ram:hiscore" : 
  658.    Rem load hiscore 
  659.    Input #1,HISCORE
  660.    Close 1
  661.    Rem set up noises and make cycles Appear 
  662.    ' after playing each sample, wait 1.5 seconds
  663.    Sam Bank 11
  664.    Sam Play 1
  665.    Ink BIKETRAIL : Bar BIKEX-2,BIKEY-2 To BIKEX+2,BIKEY+2
  666.    Wait 95
  667.    Sam Play 1
  668.    Ink ENEMYTRAIL
  669.    Bar ENEM1X-2,ENEM1Y-2 To ENEM1X+2,ENEM1Y+2
  670.    Wait 60
  671.    If LEVEL(CURRENTPLAYER)>1
  672.       Bar ENEM2X-2,ENEM2Y-2 To ENEM2X+2,ENEM2Y+2
  673.       Sam Play 1
  674.       Wait 60
  675.    End If 
  676.    If LEVEL(CURRENTPLAYER)>2
  677.       Bar ENEM3X-2,ENEM3Y-2 To ENEM3X+2,ENEM3Y+2
  678.       Sam Play 1
  679.       Wait 60
  680.    End If 
  681.    If LEVEL(CURRENTPLAYER)=1
  682.       ' play "we have transport", wait 1.5 seconds to start game 
  683.       Sam Play 2
  684.       Wait 90
  685.    End If 
  686. Return 
  687.  
  688. AGAINPLAY: Rem play again sequence
  689.    Paper 0 : Pen 3
  690.    Locate 58,47 : GOAGAIN$=" " : Input "Play again(y/n)?: ";GOAGAIN$
  691.    If GOAGAIN$="N" or GOAGAIN$="n"
  692.       CLEANUP: End 
  693.    Else 
  694.       SCORE(2)=0 : LEVEL(2)=1 : PLIFE(2)=3 : Rem reset scores,lives, and level
  695.       If TWOMODE=True
  696.          SCORE(6)=0 : LEVEL(6)=1 : PLIFE(6)=3 : CURRENTPLAYER=2
  697.       Else 
  698.          PLIFE(6)=0 : SCORE(6)=0 : LEVEL(6)=1 : Rem set player 6 lives to 0
  699.          ' for one player mode (explained in code sequence to check # of lives)   
  700.       End If 
  701.    End If 
  702. Return 
  703.  
  704. BONUS:
  705.    If SCORE(CURRENTPLAYER) mod 1000=0
  706.       PLIFE(CURRENTPLAYER)=PLIFE(CURRENTPLAYER)+1
  707.       For T=1 To PLIFE(CURRENTPLAYER)
  708.          Bob T,454+(T*16),35,IMAGE
  709.       Next T : Rem end of placing bases 
  710.    End If 
  711. Return 
  712.  
  713. Procedure CLEANUP
  714.    Erase All 
  715.    Kill "ram:hiscore"
  716.    End 
  717. End Proc